home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Mops 2.7 / Mops source / Toolbox classes / Window < prev    next >
Encoding:
Text File  |  1995-11-24  |  2.2 KB  |  90 lines  |  [TEXT/MSET]

  1. \ Window class.
  2.  
  3. \  May    91 mrh    Added NonScrollWind.
  4. \        Default grow and drag limits set at grow and drag time.
  5. \        Also fixed a number of long-standing bugs in draw:, enable:, disable:
  6. \        etc.  New: deactivates current window.  Added PenIntoWind:.
  7. \  July 91 mrh    Moved Window class into module WindowMod.
  8.  
  9.  
  10.         variable    THEWINDOW
  11.   -1    constant    INFRONT
  12.         variable    THEPORT
  13.  129    constant    THUMB
  14.  
  15.    0    constant    DOCWIND
  16.   16    constant    RNDWIND
  17.    1    constant    DLGWIND
  18.  
  19.    0    value    ACTW        \ Indentifies any active Mops window which
  20.                     \ should be idled.  Will be set zero if we have, say,
  21.                     \ a dialog as the front window, but NOT if we're
  22.                     \ switched into the background.
  23.  
  24.     0    value    SaveActW    \ Saves actW over Suspend-Resume
  25.  
  26. forward    WHRFEV                \ Will become  where: fEvent
  27.  
  28. \ NoClip is a very useful word...
  29.  
  30. : NOCLIP    0 0 32766 dup  put: tempRect  addr: tempRect  call ClipRect  ;
  31.  
  32.  
  33. \ ( val -- )  These next words set text characteristics for current grafPort
  34.  
  35. : TFONT        makeInt  call TextFont  ;
  36. : TFACE        makeInt  call TextFace  ;
  37. : TMODE        makeInt  call TextMode  ;
  38. : TSIZE        makeInt  call TextSize  ;
  39.  
  40. : INITFONT    9 tsize  4 tfont ( Monaco )  0 tMode  0 tFace  ;
  41.  
  42. : TBOOL        \ ( b -- bool )  Makes a Mops boolean into a Toolbox boolean
  43.     $ 100  and  makeint  ;
  44.  
  45. \ Save and restore the GrafPort
  46.  
  47. : SAVEPORT    thePort    call GetPort  ;
  48. : RESTPORT    thePort @  call SetPort  ;
  49.  
  50. \ Utility routines for calculating a scroll bar's position.
  51.  
  52. : >VRECT  { left top rt bot -- l' t' r' b' }
  53.     rt 15 -    top 1-    rt 1+    bot 14 -   ;
  54.  
  55. : >HRECT  { left top rt bot -- l' t' r' b' }
  56.     left 1-    bot 15 -    rt 14 -    bot 1+   ;
  57.  
  58.  
  59. syscall NewWindow
  60. sysCall NewCWindow
  61. syscall GetNewWindow
  62. syscall GetNewCWindow
  63.  
  64.  
  65. from WindowMod  import{  WINDOW  }
  66.  
  67. compile: windowMod
  68. lock: windowMod
  69. true  setinstall: windowMod
  70.  
  71.  
  72. \ NonScrollWind is a window that will not scroll.  This preserves fprect which we
  73. \  may be using for scrolling text somewhere else.
  74.  
  75. :class    NONSCROLLWIND    super{ window }
  76.  
  77. :m  CLASSINIT:
  78.     classinit: super  false setScroll: self   ;m
  79.  
  80. ;class
  81.  
  82.  
  83. fWind  ' window  set_class
  84. classinit: fWind    markalive: fWind
  85.  
  86.  
  87. true value    fWindActive?    \ Will be true only when fwind is active.
  88.                             \ It is set/reset by enFW and disFW (see
  89.                             \ FEMod.txt).
  90.